%module example_pb

%inline
%{

#include <sstream>
#include "google/protobuf/stubs/common.h"
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/message.h"
#include "example.pb.h"

%}

%include "basic.i"


/* Forward class declarations */
class Msg_Inner;
class Msg;


/* Enums */
enum Msg_EnumType
{
  Msg_EnumType_one = 0,
  Msg_EnumType_two = 1,
};


/* Classes */
class Msg_Inner : public ::google::protobuf::Message
{
  public:
    Msg_Inner();
    Msg_Inner(const Msg_Inner& from);
    virtual ~Msg_Inner();

    static const Msg_Inner& default_instance();
    void Swap(Msg_Inner* other);
    Msg_Inner* New() const;
    void CopyFrom(const ::google::protobuf::Message& from);
    void MergeFrom(const ::google::protobuf::Message& from);
    void CopyFrom(const Msg_Inner& from);
    void MergeFrom(const Msg_Inner& from);
    void Clear();
    bool IsInitialized() const;
    int ByteSize() const;
    int GetCachedSize() const;

    // Nested types

    // Fields

    // f
    inline bool has_f() const;
    inline void clear_f();
    static const int kFFieldNumber = 1;
    %rename(f) mutable_f;
    inline ::std::string* mutable_f();
    inline void set_f(const char* value);
    inline void set_f(const char* value, size_t size);
};
%extend Msg_Inner
{
   ::std::string __str__()
   {
       ::std::stringstream ss(::std::stringstream::in | ::std::stringstream::out);
       ss << "<" << $self->GetTypeName();
       ss << " { " << $self->ShortDebugString() << " } at " << $self << ">";
       return ss.str();
   }
};

%feature("shadow") Msg::mutable_sr(int)
%{
    def sr(self, index):
       if self.sr_size() <= index:
            raise IndexError("index out of range")
       return $action(self, index)
%}

%feature("shadow") Msg::set_sr(int, const char*)
%{
    def set_sr(self, index, value):
      if self.sr_size() <= index:
            raise IndexError("index out of range")
      return $action(self, index, value)
%}

%feature("shadow") Msg::set_sr(int, const char*, size_t)
%{
    def set_sr(self, index, value, size):
      if self.sr_size() <= index:
            raise IndexError("index out of range")
      return $action(self, index, value, size)
%}

class Msg : public ::google::protobuf::Message
{
  public:
    Msg();
    Msg(const Msg& from);
    virtual ~Msg();

    static const Msg& default_instance();
    void Swap(Msg* other);
    Msg* New() const;
    void CopyFrom(const ::google::protobuf::Message& from);
    void MergeFrom(const ::google::protobuf::Message& from);
    void CopyFrom(const Msg& from);
    void MergeFrom(const Msg& from);
    void Clear();
    bool IsInitialized() const;
    int ByteSize() const;
    int GetCachedSize() const;

    // Nested types
    typedef Msg_Inner Inner;
    typedef Msg_EnumType EnumType;

    // Fields

    // data
    inline bool has_data() const;
    inline void clear_data();
    static const int kDataFieldNumber = 1;
    %rename(data) mutable_data;
    inline ::std::string* mutable_data();
    inline void set_data(const char* value);
    inline void set_data(const char* value, size_t size);

    // i
    inline bool has_i() const;
    inline void clear_i();
    static const int kIFieldNumber = 2;
    inline ::google::protobuf::int32 i() const;
    inline void set_i(::google::protobuf::int32 value);

    // d
    inline bool has_d() const;
    inline void clear_d();
    static const int kDFieldNumber = 3;
    inline double d() const;
    inline void set_d(double);

    // f
    inline bool has_f() const;
    inline void clear_f();
    static const int kFFieldNumber = 4;
    inline float f() const;
    inline void set_f(float);

    // f32
    inline bool has_f32() const;
    inline void clear_f32();
    static const int kF32FieldNumber = 5;
    inline ::google::protobuf::uint32 f32() const;
    inline void set_f32(::google::protobuf::uint32);

    // f64
    inline bool has_f64() const;
    inline void clear_f64();
    static const int kF64FieldNumber = 6;
    inline ::google::protobuf::uint64 f64() const;
    inline void set_f64(::google::protobuf::uint64);

    // b
    inline bool has_b() const;
    inline void clear_b();
    static const int kBFieldNumber = 7;
    inline bool b() const;
    inline void set_b(bool);

    // by
    inline bool has_by() const;
    inline void clear_by();
    static const int kByFieldNumber = 8;
    %rename(by) mutable_by;
    inline ::std::string* mutable_by();
    inline void set_by(const char* value);
    inline void set_by(const char* value, size_t size);

    // e
    inline void clear_e();
    static const int kEFieldNumber = 9;
    inline int e_size() const;
    inline ::Msg_EnumType e(int index) const;
    inline void set_e(int index, ::Msg_EnumType value);
    inline void add_e(::Msg_EnumType value);

    // inner
    inline void clear_inner();
    static const int kInnerFieldNumber = 10;
    inline int inner_size() const;
    %rename(inner) mutable_inner;
    inline ::Msg_Inner* mutable_inner(int index);
    inline ::Msg_Inner* add_inner();

    // r
    inline void clear_r();
    static const int kRFieldNumber = 11;
    inline int r_size() const;
    inline ::google::protobuf::int32 r(int index) const;
    inline void set_r(int index, ::google::protobuf::int32 value);
    inline void add_r(::google::protobuf::int32 value);

    // sr
    inline void clear_sr();
    static const int kSrFieldNumber = 12;
    inline int sr_size() const;
    inline ::std::string* mutable_sr(int index);
    inline void set_sr(int index, const char* value);
    inline void set_sr(int index, const char* value, size_t size);
    inline ::std::string* add_sr();
    inline void add_sr(const char* value);
    inline void add_sr(const char* value, size_t size);

    // re
    inline bool has_re() const;
    inline void clear_re();
    static const int kReFieldNumber = 13;
    inline ::google::protobuf::int32 re() const;
    inline void set_re(::google::protobuf::int32 value);
};
%extend Msg
{
   ::std::string __str__()
   {
       ::std::stringstream ss(::std::stringstream::in | ::std::stringstream::out);
       ss << "<" << $self->GetTypeName();
       ss << " { " << $self->ShortDebugString() << " } at " << $self << ">";
       return ss.str();
   }
};



